Subtyping and Parametricity

نویسندگان

  • Gordon D. Plotkin
  • Martín Abadi
  • Luca Cardelli
چکیده

In this paper we study the interaction of subtyping and parametricity. We describe a logic for a programming language with parametric polymorphism and subtyping. The logic supports the formal definition and use of relational parametricity. We give two models for it, and compare it with other formal systems for the same language. In particular, we examine the “Penn interpretation” of subtyping as implicit coercion. Without subtyping, parametricity yields, for example, an encoding of abstract types and of initial algebras, with the corresponding proof principles of simulation and induction. With subtyping, we obtain partially abstract types and certain initial order-sorted algebras, and may derive proof principles for them.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Parametricity as Subtyping (preliminary Report)

A polymorphic function is parametric if it has uniform behavior for all type parameters. This property is useful when writing, reasoning about, and compiling functional programs. We show how to syntactically deene and reason about parametricity in a language with intersection types and bounded polymorphism. Within this framework, parametricity is subtyping, and reasoning about para-metricity be...

متن کامل

E ective models of polymorphism , subtyping and recursion ( extended

We develop a class of models of polymorphism, subtyping and recursion based on a combination of traditional recursion theory and simple domain theory. A signi cant property of our primary model is that types are coded by natural numbers using any index of their supremum operator. This leads to a distinctive view of polymorphic functions that has many of the usual parametricity properties. It al...

متن کامل

A Blame for All (revised)

Several programming languages are beginning to integrate static and dynamic typing, including Racket, Microsoft’s C# 4.0 (Hejlsberg 2010) and TypeScript (Hejlsberg, 2012), Facebook’s PHP (Verlaguet, 2013), and the research languages Sage (Gronski, Knowles, Tomb, Freund, and Flanagan, 2006) and Thorn (Wrigstad, Eugster, Field, Nystrom, and Vitek, 2009). However, an important open question remain...

متن کامل

Polymorphic Contracts

Manifest contracts track precise properties by refining types with predicates—e.g., {x :Int | x > 0} denotes the positive integers. Contracts and polymorphism make a natural combination: programmers can give strong contracts to abstract types, precisely stating preand post-conditions while hiding implementation details—for example, an abstract type of stacks might specify that the pop operation...

متن کامل

An Extension of System F with Subtyping

System F is a well-known typed λ-calculus with polymorphic types, which provides a basis for polymorphic programming languages. We study an extension of F, called F<: (pronounced ef-sub) that combines parametric polymorphism with subtyping. The main focus of the paper is the equational theory of F<: , which is related to PER models and the notion of parametricity. We study some categorical prop...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1994